<template>
  <div class="add-container">
    <div class="add-top">
      <el-page-header @back="goBack" :content="gobacktitle"></el-page-header>
    </div>
    <div class="add-main">
      <div class="add-main-top">
        <el-descriptions
          title="入库任务单"
          direction="vertical"
          :column="10"
          border
          id="descriptions"
        >
          <el-descriptions-item label="任务单号">
            {{ ruleForm.renwudh }}
          </el-descriptions-item>
          <el-descriptions-item label="起始点">
            {{ ruleForm.qishid }}
          </el-descriptions-item>
          <!-- <el-descriptions-item label="终结点">
            {{ ruleForm.zhongjied }}
          </el-descriptions-item> -->

          <el-descriptions-item label="入库单号">
            {{ ruleForm.rukudh }}
          </el-descriptions-item>

          <el-descriptions-item label="挂架码">
            {{ ruleForm.guajiam }}
          </el-descriptions-item>
          <el-descriptions-item label="货位">
            {{ ruleForm.huoweih }}
          </el-descriptions-item>
          <el-descriptions-item label="托盘号">
            {{ ruleForm.tuopanh }}
          </el-descriptions-item>

          <el-descriptions-item label="状态">
            <span v-if="ruleForm.zhuangtai == 0">验收</span>
            <span v-if="ruleForm.zhuangtai == 1">未开始</span>
            <span v-if="ruleForm.zhuangtai == 2">进行中</span>
            <span v-if="ruleForm.zhuangtai == 3">入库完成</span>
            <span v-if="ruleForm.zhuangtai == 4">扫码确认</span>
          </el-descriptions-item>
          <el-descriptions-item label="备注">
            {{ ruleForm.tips }}
          </el-descriptions-item>
        </el-descriptions>
      </div>

      <div class="add-main-list2">
        <div class="add-main-tital">
          <p>入库任务单明细</p>
        </div>
        <div class="table-list">
          <ux-grid
            border
            show-overflow
            ref="plxTable"
            keep-source
            height="tabheight"
            :highlightCurrentRow="false"
            widthResize
          >
            <ux-table-column
              type="index"
              title="序号"
              width="50"
            ></ux-table-column>
            <ux-table-column
              field="mingcheng"
              title="挂架名称"
            ></ux-table-column>
            <ux-table-column field="xingbie" title="型别"></ux-table-column>
            <ux-table-column
              field="chuchanghm"
              title="出厂号码"
            ></ux-table-column>
            <ux-table-column field="weiyibm" title="唯一编码"></ux-table-column>
            <ux-table-column field="guazaih" title="挂载号"></ux-table-column>
            <ux-table-column field="guishuh" title="归属号"></ux-table-column>
            <ux-table-column
              field="shengchancj"
              title="生产厂家"
            ></ux-table-column>
            <ux-table-column field="guajiazt" title="挂架状态">
              <template v-slot="scope">
                {{ $util.getguajiazt(scope.row.guajiazt) }}
              </template>
            </ux-table-column>
          </ux-grid>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  import { queryguajiaListIDS } from '@/api/kunei'
  export default {
    name: 'Page2Deatail',
    props: {
      gobacktitle: {
        type: String,
        default: '新增',
        required: true,
      },
      datarow: {
        type: Object,
        default: function () {
          return {}
        },
      },
    },
    data() {
      return {
        show: true,
        ruleForm: {},
        tabheight: 500,
        centerDialogVisible: false,
      }
    },
    created() {
      this.getGuajiaList()
    },
    mounted() {
      this.ruleForm = Object.assign({}, this.datarow)
      this.$nextTick(() => {
        this.$refs.plxTable.reloadData(this.ruleForm.shangjiadmxList)
      })
    },
    methods: {
      getGuajiaList() {
        queryguajiaListIDS({ ids: this.datarow.guajiamid }).then((res) => {
          this.$refs.plxTable.reloadData(res.data)
        })
      },
      goBack() {
        this.$parent.detailshow = false
      },
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!')
          } else {
            return false
          }
        })
      },
      resetForm(formName) {
        this.$refs[formName].resetFields()
      },
      selectChange(e) {},
      uploadSuccess() {
        this.importShow = false
      },
    },
  }
</script>
<style lang="scss" scoped>
  .add-container {
    position: fixed;
    left: 0;
    top: 0.75rem;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background-color: #f6f8f9;
    padding: 0 0.2rem 1rem 0.2rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;

    .add-top {
      padding: 0.1rem 0;

      ::v-deep .el-page-header__title {
        font-size: 0.16rem !important;
      }
    }

    .add-main-tital {
      font-size: 18px;
      border-left: 10px solid rgb(121, 189, 255);
      padding-left: 10px;
      margin: 20px 0 20px;

      p {
        margin: 0;
      }
    }

    .add-main {
      flex: 1;
      font-weight: bold;
      display: flex;
      flex-direction: column;
      overflow: auto;

      .add-main-list2 {
        flex: 1;
        background: #fff;
        padding: 0 20px;
        box-sizing: border-box;

        .list-button-group {
          display: flex;
          flex-direction: row;
          padding-bottom: 20px;

          .button-item {
            padding: 0px 10px;
          }

          .button-item:first-child,
          &:last-child {
            padding: 0px 10px 0 0;
          }
        }
      }

      .el-button {
        font-size: 0.14rem !important;
      }

      ::v-deep {
        .elx-table--header-wrapper {
          background-color: rgb(233, 243, 255);
        }

        .elx-table {
          font-size: 0.14rem !important;
        }

        .elx-body--column {
          height: 0.48rem !important;
          line-height: 0.24rem;
        }

        .elx-header--column {
          background-image: none !important;
          height: 0.48rem !important;
        }
      }

      .submit-button {
        margin-top: 20px;
        display: flex;
        justify-content: center;
      }
    }
  }
</style>
